package com.iwop.moto.service.impl;

import com.iwop.moto.model.MCoupon;
import com.iwop.moto.model.SuperRecordModel;
import com.iwop.moto.service.BaseService;
import com.iwop.moto.service.FCouponService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by mobom on 2016/11/2.
 */
@Service
public class FCouponServiceImpl extends BaseService implements FCouponService {

    @Override
    public List<SuperRecordModel> getCouponByType(SuperRecordModel srm) {
        return getSqlSession().selectList("MCouponMappper.getCouponByType", srm);
    }

    @Override
    public int insertUserCoupon(SuperRecordModel suprm) {
        return getSqlSession().insert("MCouponMappper.insertUserCoupon",suprm);
    }


    public MCoupon getCouponById(String sid) {
        return getSqlSession().selectOne("MCouponMappper.getCouponById", sid);
    }


    @Override
    public void modifyCouponProvideNum(SuperRecordModel srm2) {
        getSqlSession().update("MCouponMappper.update", srm2);
    }

    @Override
    public void updateNumBySid(String sid) {
        getSqlSession().update("MCouponMappper.updateNumBySid", sid);

    }

    @Override
    public MCoupon getCouponByMoney(MCoupon mCoupon) {
        return getSqlSession().selectOne("MCouponMappper.getCouponByMoney", mCoupon);
    }
}
